package org.test.javaCharacteristic.baseType;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import org.junit.Test;

/**
 * 基本数据类型
 * @author Administrator
 * 2012-3-19
 *
 */
public class basictype {

	int int1;
	String string1;
	char char1;
	long long1;
	float float1;
	double double1;

	/**
	 * 打印变量默认值
	 */
	// @Test
	public void testc() {

		System.out.println((new basictype()).toString());
	}

	@Override
	public String toString() {
		return "basictype [int1=" + int1 + ", string1=" + string1 + ", char1="
				+ char1 + ", long1=" + long1 + ", float1=" + float1
				+ ", double1=" + double1 + "]";
	}

	/**
	 * int类型的相互转换
	 * 
	 * 
	 */
//	@Test
	public void test3(){
		
		int src = 787687678;

		long l3 = src;
		double d3 = src;
		float f3 = src;
		
		byte b3 = (byte) src;
		char c3 = (char) src;
		
//		String string3 = Integer.toString(i,10);//十进制输出
//		String string3 = Integer.toString(i,2);//二进制输出
		String string3 = src+"";
		
		
		//默认,数型都以10进制输出
	System.out.println("i:"+src 
				+"\nlong3:"+l3
				+"\ndouble3:"+d3
				+"\nbyte3:"+b3
				+"\nchar3:"+c3
				+"\nfloat3:"+f3
				+"\nstring3:"+string3
				);
	}
	
	
	
	
	/**
	 * 
	 * 
	 * char型的转换
	 */
//	@Test
	public void test4(){
		
		char src = 'y';
		
		long l3 = src;
		double d3 = src;
		float f3 = src;
		int int3 = src;
		
		byte b3 = (byte) src;
		
		String string3 = src+"";
		
		//
	System.out.println("char:"+src 
				+"\nlong3:"+l3
				+"\ndouble3:"+d3
				+"\nbyte3:"+b3
				+"\nint3:"+int3
				+"\nfloat3:"+f3
				+"\nstring3:"+string3
				);
	}
	
	
	
	/**
	 *byte
	 */
	@Test
	public void test5(){
		
		byte src = 19;
		
		long l3 = src;
		double d3 = src;
		float f3 = src;
		int int3 = src;
		
		char char3 = (char) src;
		
		String string3 = src+"";
		
		//
	System.out.println("char:"+src 
				+"\nlong3:"+l3
				+"\ndouble3:"+d3
				+"\nchar3:"+char3
				+"\nint3:"+int3
				+"\nfloat3:"+f3
				+"\nstring3:"+string3
				);
	}
		
		
		
	}
	
	
	
	
